package com.ljx.funchat.chat.controller;


import com.ljx.funchat.chat.domain.vo.resp.ChatRoomResp;
import com.ljx.funchat.chat.service.IContactService;
import com.ljx.funchat.chat.service.IRoomService;
import com.ljx.funchat.common.domain.vo.req.CursorPageBaseReq;
import com.ljx.funchat.common.domain.vo.resp.ApiResult;
import com.ljx.funchat.common.domain.vo.resp.CursorPageBaseResp;
import com.ljx.funchat.common.utils.RequestHolder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 会话表 前端控制器
 * </p>
 *
 * @author LiJunXi
 * @since 2024-02-14
 */
@Api(tags = "聊天接口")
@RestController
@RequestMapping("/chat")
public class ContactController {

    @Autowired
    private IContactService contactService;

    @ApiOperation("会话列表")
    @GetMapping("/contact/page")
    public ApiResult<CursorPageBaseResp<ChatRoomResp>> getRoomPage(@Valid CursorPageBaseReq req){
        Long uid = RequestHolder.get().getUid();

        return ApiResult.success(contactService.getContactPage(uid, req));
    }


}

